﻿using Microsoft.AspNetCore.Mvc;
using MiniFox.Infrastructure;
using MiniFox.Platform.Applications.Web;
using MiniFox.Utility;
using MiniFox.Web.Filters;
using MiniFox.Web.Infrastructure;
using Sys.Core;
using Sys.Core.Models.Queries;
using Sys.Core.Models.VO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sys.Controllers
{
    [NoCache, ValidationFilter, Area(GlobalConstants.AREA_NAME)]
    public class MessageController : AuthorizedController<IDispatcherService>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<ResultObject<IEnumerable<MessageVo>>> Query([FromBody] PagedQueryObject<MessageQuery> query)
        {
            ResultObject<IEnumerable<MessageVo>> result = this.Component.MessageQuery(query);

            return result.CreateResponse();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="messageId"></param>
        /// <returns></returns>
        [HttpGet]
        public Response<MessageVo> Item([FromQuery] string messageId)
        {
            MessageVo item = this.Component.MessageItem(messageId);

            return item.CreateResponse();
        }

    }
}
